<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Javascript对象-new创建对象的过程</title>
</head>

<body>
    <script>
        function newFunc(constructor, ...args) {
            let _newObj = Object.create(null) //1.创建一个空对象
            _newObj.__proto__ = constructor.prototype; //2.把这个空对象的__proto__属性指向构造函数的prototype对象
            constructor.apply(_newObj, args); //3.调用构造器
            return _newObj; //4.返回创建的对象
        }
    </script>
</body>

</html>